package com.shop2cn.iapi.agentproducts.testcase;

import java.io.File;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.agentproducts.parameter.UploadsPicBean;
import com.shop2cn.iapi.agentproducts.service.UploadsPicCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.utils.AgentUsers;
import com.ymttest.utils.TestDataManager;
/**
*上传商品图片
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_UploadsPic{
	private static UploadsPicBean uploadspicBean;
	private static UploadsPicCall uploadspicCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("上传商品图片");
	}

	@Before
	public void caseUp() {
		uploadspicBean=new UploadsPicBean();
		uploadspicCall=new UploadsPicCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(uploadspicCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	//vip渠道
		private static int vipRootUserId = AgentUsers.vipRootUserId;
		private static String vipRootUserName = "NickautoTest";
		private static int csId = AgentUsers.csId;
		private static String csName = "NickautoTest";
		//vip渠道->代理
		private static int vipAgentUserId1 = AgentUsers.vipAgentUserId1;
		private static String vipAgentUserName1 = "dgsq408897016";
		private static int csId1 = AgentUsers.csId1;
		
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UploadsPic_01() {
		Logger.start(true,"上传商品图片");
		try {
			 String f1 = System.getProperty("user.dir") + File.separator
					    + "resource" + File.separator + "Penguins.jpg";
			String picUrl= TestDataManager.UploadFile(f1);
					     
//			 System.out.println(System.getProperty("user.dir")+"\\resource\\Penguins.jpg");
//			List<File> files=new ArrayList<File>();
//			files.add(new File(System.getProperty("user.dir")+"\\resource\\Penguins.jpg"));
			uploadspicBean.setFile(picUrl);
			uploadspicBean.setType("shenqiProduct");
			uploadspicBean.setRootUserId(vipRootUserId);
//			uploadspicBean.setScene("");
			uploadspicCall.setData(uploadspicBean);
			uploadspicCall.callService();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}